package com.kdzy.lshy.socity_server.controller;

import com.kdzy.lshy.socity_server.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author rtt
 */
@RestController
@RequestMapping("/user")
@Api(value = "用户登录")
@CrossOrigin("*")
public class UserController {
    @Autowired
    private UserService userService;

    @PostMapping(value = "/userlogin")
    @ApiOperation(value = "登录方法", httpMethod = "POST")
    public Object login(@ApiParam(name = "param", value = "参数详情", required = true) String param, HttpServletRequest request) {

        return userService.userLogin(param, request);
    }

    ;

   //登退
    @PostMapping("/loginout")
    public Object edit(String param, HttpServletRequest request) {

        return userService.edit(param, request);
    };

    //身份证信息读取
    @PostMapping("/readCard")
    public void readIdCard() {
        String filePath = "D:\\boot.txt";
        userService.readIdCard(filePath);
    }

    //打包下载（窗口，地址，电话，清单，资料本身）
    @GetMapping("/packdownload")
    public Object packdownload(String param, HttpServletResponse response) {

        return userService.packdownload(param, response);
    }

//    //打包下载（窗口，地址，电话，清单，资料本身） - 保存到本地
//    @GetMapping("/packdownload2")
//    public Object packdownload2(String param, HttpServletResponse response) {
//
//        return userService.packdownload2(param, response);
//    }
//
//    //打包下载（窗口，地址，电话，清单，资料本身） - 后台生成二维码传给前台
//    @GetMapping("/packdownload4")
//    public Object packdownload4(String param, HttpServletResponse response) {
//
//        return userService.packdownload4(param, response);
//    }
//
//    //打包下载（窗口，地址，电话，清单，资料本身） - 发下载链接短信
//    @GetMapping("/packdownload3")
//    public Object packdownload3(String param, HttpServletResponse response) {
//
//        return userService.packdownload3(param, response);
//    }
};
